<template>
	<view class="consume">
		<view class="consume-item" v-for="(item, index) in creditList" :key="index">
			<view class="consume-left">
				<view class="num">({{ item.ordersn }})</view>
				<view class="time">{{ item.createtime }}</view>
			</view>
			<view class="" style="display: flex;align-items: center;">{{ item.type }}</view>
			<view class="money">
				<view v-if="item.status == '已结算'" style="color: #009688;">{{ item.bonus }}</view>
				<view v-else>{{ item.bonus }}</view>
				<view v-if="item.status == '已结算'" style="color: #009688;">{{ item.status }}</view>
				<view v-else>{{ item.status }}</view>
			</view>
		</view>
		<view class="consume-img" v-if="creditList.length == 0">
			<image class="img" src="../../static/img/record.png" mode=""></image>
			<view class="text">暂无记录</view>
		</view>
	</view>
</template>

<script>
	import service from '@/store/service.js';
	export default {
		data() {
			return {
				creditList: [],
			};
		},
		onLoad: function() {
			this.getMyCredit();
		},
		methods: {
			jump(url, id) {
				uni.navigateTo({
					url: url
				});
			},
			getMyCredit() {
				var self = this;
				self.$http
					.get(service.api.user.directPush, {})
					.then(function(res) {
						var list = res.data;
						self.creditList = list
					});
			}
		}
	};
</script>

<style scoped>
	.consume-item {
		background-color: #fff;
		margin-top: 20upx;
		display: flex;
		justify-content: space-between;
		padding: 28upx 22upx 22upx;
	}

	.num {
		font-weight: bold;
	}

	.time {
		color: #999;
		font-size: 24upx;
		font-weight: 500;
	}

	.money {
		display: flex;
		flex-direction: column;
		align-items: center;
		color: #f81149;
	}

	.consume-img {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		margin-top: 296upx;
	}

	.img {
		width: 522upx;
		height: 350upx;
	}

	.text {
		color: #333;
		font-weight: bold;
	}
</style>
